package com.sfteam.bmw.api;

import java.util.List;

import com.jfinal.core.Controller;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.sfteam.bmw.model.Carousel;
import com.sfteam.bmw.vo.AjaxResult;

/**
 * 轮播api
 * 
 * @author knight322
 *
 */
public class CarouselApi extends Controller {

	static Log logger = Log.getLog(CarouselApi.class);

	private AjaxResult result = new AjaxResult();

	public void index() {
		String type = getPara("type");
		List<Carousel> list = Carousel.dao
				.find("select cover,contentId from t_carousel where type = ? order by updateTime desc",
						type);
		if (StrKit.notNull(list) && list.size() > 0) {
			result.success(list);
		} else {
			result.addError("该类轮播信息不存在！");
		}
		renderJson(result);
	}
}
